package observer;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.Color;

public class ValoareCurentaBara extends Canvas implements Observer
{
	private int ultimaVal=0;
	
	//Notifica obiectele atunci cand se face o schimbare 
	public void upDate(Subject s)
	{
		ultimaVal=s.getVal();
		repaint();
	}
	
	//Updateaza interfata grafica
	public void update (Graphics g)
	{
		super.update(g);
	}

	//Deseneaza obiectele
	public void paint (Graphics g)
	{
		g.drawRect(0, 0, 80, 20);
		g.setColor(Color.blue);
		g.fillRect(0, 0, ultimaVal, 20);
	}
}
